package com.foxzzz.binary.search;

public class Solution278 {
    boolean isBadVersion(int version) {
        return version >= 1702766719;
    }

    public int firstBadVersion(int n) {
        int low = 1;
        int high = n;
        int mid =0;
        while (low < high) {
            mid = (int) (((long)low + high) / 2);
            if (isBadVersion(mid)) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        return high;
    }

    public static void main(String[] args) {
        System.out.println(new Solution278().firstBadVersion(2126753390));
    }
}
